Use the X11-specific API instead.
g_assert (icon->priv->manager_window != None);
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
type = None;
result = XGetWindowProperty (xdisplay,
icon->priv->manager_window,
XA_CARDINAL,
&type, &format, &nitems,
&bytes_after, &(prop.prop_ch));
- error = gdk_error_trap_pop ();
+ error = gdk_x11_display_error_trap_pop (display);
if (error || result != Success)
return;
g_assert (icon->priv->manager_window != None);
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
type = None;
result = XGetWindowProperty (xdisplay,
icon->priv->manager_window,
XA_VISUALID,
&type, &format, &nitems,
&bytes_after, &(prop.prop_ch));
- error = gdk_error_trap_pop ();
+ error = gdk_x11_display_error_trap_pop (display);
if (!error && result == Success &&
type == XA_VISUALID && nitems == 1 && format == 32)
g_assert (icon->priv->manager_window != None);
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
type = None;
result = XGetWindowProperty (xdisplay,
icon->priv->manager_window,
XA_CARDINAL,
&type, &format, &nitems,
&bytes_after, &(prop.prop_ch));
- error = gdk_error_trap_pop ();
+ error = gdk_x11_display_error_trap_pop (display);
if (error || result != Success)
return;
g_assert (icon->priv->manager_window != None);
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
type = None;
result = XGetWindowProperty (xdisplay,
icon->priv->manager_window,
XA_CARDINAL,
&type, &format, &nitems,
&bytes_after, &(prop.prop_ch));
- error = gdk_error_trap_pop ();
+ error = gdk_x11_display_error_trap_pop (display);
if (!error && result == Success &&
type == XA_CARDINAL && nitems == 1 && format == 32)
g_assert (icon->priv->manager_window != None);
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
type = None;
result = XGetWindowProperty (xdisplay,
icon->priv->manager_window,
XA_CARDINAL,
&type, &format, &nitems,
&bytes_after, &(prop.prop_ch));
- error = gdk_error_trap_pop ();
+ error = gdk_x11_display_error_trap_pop (display);
if (!error && result == Success &&
type == XA_CARDINAL && nitems == 1 && format == 32)
{
GtkWidget *widget;
XClientMessageEvent ev;
- Display *display;
+ GdkDisplay *display;
+ Display *xdisplay;
widget = GTK_WIDGET (icon);
ev.data.l[3] = data2;
ev.data.l[4] = data3;
- display = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (widget));
+ display = gtk_widget_get_display (widget);
+ xdisplay = GDK_DISPLAY_XDISPLAY (display);
- gdk_error_trap_push ();
- XSendEvent (display,
- icon->priv->manager_window, False, NoEventMask, (XEvent *)&ev);
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_push (display);
+ XSendEvent (xdisplay,
+ icon->priv->manager_window,
+ False, NoEventMask,
+ (XEvent *)&ev);
+ gdk_x11_display_error_trap_pop_ignored (display);
}
static void
gint len)
{
guint stamp;
+ GdkDisplay *display;
Display *xdisplay;
g_return_val_if_fail (GTK_IS_TRAY_ICON (icon), 0);
timeout, len, stamp);
/* Now to send the actual message */
- xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
- gdk_error_trap_push ();
+ display = gtk_widget_get_display (GTK_WIDGET (icon));
+ xdisplay = GDK_DISPLAY_XDISPLAY (display);
+ gdk_x11_display_error_trap_push (display);
while (len > 0)
{
XClientMessageEvent ev;
icon->priv->manager_window, False,
StructureNotifyMask, (XEvent *)&ev);
}
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_pop_ignored (display);
return stamp;
}
guint32 time)
{
guint i;
+ GdkDisplay *display;
GdkWindow *window, *root;
gint keycode;
#ifdef XINPUT_2
using_xi2 = FALSE;
#endif
+ display = gtk_widget_get_display (widget);
root = gdk_screen_get_root_window (gtk_widget_get_screen (widget));
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
for (i = 0; i < G_N_ELEMENTS (grab_keys); ++i)
{
GrabModeAsync);
}
- gdk_flush ();
- gdk_error_trap_pop_ignored ();
+ gdk_display_flush (display);
+ gdk_x11_display_error_trap_pop_ignored (display);
gdk_window_add_filter (NULL, root_key_filter, (gpointer) GDK_WINDOW_XID (window));
}
{
guint i;
GdkWindow *window, *root;
+ GdkDisplay *display;
gint keycode;
#ifdef XINPUT_2
XIGrabModifiers mods;
using_xi2 = FALSE;
#endif
+ display = gtk_widget_get_display (widget);
root = gdk_screen_get_root_window (gtk_widget_get_screen (widget));
gdk_window_remove_filter (NULL, root_key_filter, (gpointer) GDK_WINDOW_XID (window));
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
for (i = 0; i < G_N_ELEMENTS (grab_keys); ++i)
{
GDK_WINDOW_XID (root));
}
- gdk_flush ();
- gdk_error_trap_pop_ignored ();
+ gdk_display_flush (display);
+ gdk_x11_display_error_trap_pop_ignored (display);
}
#else /* !GDK_WINDOWING_X11 */
/* ---------------------------------------------------------------------------------------------------- */
/* these functions are based on code from libwnck (LGPLv2) */
-static gboolean get_window_list (Display *xdisplay,
- Window xwindow,
- Atom atom,
- Window **windows,
- int *len);
-
-static char* get_utf8_property (Display *xdisplay,
- Window xwindow,
- Atom atom);
-
-static gboolean get_cardinal (Display *xdisplay,
- Window xwindow,
- Atom atom,
- int *val);
-
-static gboolean read_rgb_icon (Display *xdisplay,
- Window xwindow,
- int ideal_width,
- int ideal_height,
- int *width,
- int *height,
- guchar **pixdata);
+static gboolean get_window_list (GdkDisplay *display,
+ Window xwindow,
+ Atom atom,
+ Window **windows,
+ int *len);
+
+static char* get_utf8_property (GdkDisplay *display,
+ Window xwindow,
+ Atom atom);
+
+static gboolean get_cardinal (GdkDisplay *display,
+ Window xwindow,
+ Atom atom,
+ int *val);
+
+static gboolean read_rgb_icon (GdkDisplay *display,
+ Window xwindow,
+ int ideal_width,
+ int ideal_height,
+ int *width,
+ int *height,
+ guchar **pixdata);
static gboolean
-get_cardinal (Display *xdisplay,
- Window xwindow,
- Atom atom,
- int *val)
+get_cardinal (GdkDisplay *display,
+ Window xwindow,
+ Atom atom,
+ int *val)
{
Atom type;
int format;
*val = 0;
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
type = None;
- result = XGetWindowProperty (xdisplay,
+ result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
xwindow,
atom,
0, G_MAXLONG,
False, XA_CARDINAL, &type, &format, &nitems,
&bytes_after, (void*)&num);
- XSync (xdisplay, False);
- err = gdk_error_trap_pop ();
+ XSync (GDK_DISPLAY_XDISPLAY (display), False);
+ err = gdk_x11_display_error_trap_pop (display);
if (err != Success ||
result != Success)
}
static char*
-get_utf8_property (Display *xdisplay,
- Window xwindow,
- Atom atom)
+get_utf8_property (GdkDisplay *display,
+ Window xwindow,
+ Atom atom)
{
Atom type;
int format;
utf8_string = gdk_x11_get_xatom_by_name ("UTF8_STRING");
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
type = None;
val = NULL;
- result = XGetWindowProperty (xdisplay,
+ result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
xwindow,
atom,
0, G_MAXLONG,
False, utf8_string,
&type, &format, &nitems,
&bytes_after, (guchar **)&val);
- XSync (xdisplay, False);
- err = gdk_error_trap_pop ();
+ XSync (GDK_DISPLAY_XDISPLAY (display), False);
+ err = gdk_x11_display_error_trap_pop (display);
if (err != Success ||
result != Success)
}
static gboolean
-read_rgb_icon (Display *xdisplay,
- Window xwindow,
- int ideal_width,
- int ideal_height,
- int *width,
- int *height,
- guchar **pixdata)
+read_rgb_icon (GdkDisplay *display,
+ Window xwindow,
+ int ideal_width,
+ int ideal_height,
+ int *width,
+ int *height,
+ guchar **pixdata)
{
Atom type;
int format;
gulong *best;
int w, h;
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
type = None;
data = NULL;
- result = XGetWindowProperty (xdisplay,
+ result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
xwindow,
gdk_x11_get_xatom_by_name ("_NET_WM_ICON"),
0, G_MAXLONG,
False, XA_CARDINAL, &type, &format, &nitems,
&bytes_after, (void*)&data);
-
- XSync (xdisplay, False);
- err = gdk_error_trap_pop ();
+ XSync (GDK_DISPLAY_XDISPLAY (display), False);
+ err = gdk_x11_display_error_trap_pop (display);
if (err != Success ||
result != Success)
}
static gboolean
-get_window_list (Display *xdisplay,
- Window xwindow,
- Atom atom,
- Window **windows,
- int *len)
+get_window_list (GdkDisplay *display,
+ Window xwindow,
+ Atom atom,
+ Window **windows,
+ int *len)
{
Atom type;
int format;
*windows = NULL;
*len = 0;
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
type = None;
- result = XGetWindowProperty (xdisplay,
+ result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
xwindow,
atom,
0, G_MAXLONG,
False, XA_WINDOW, &type, &format, &nitems,
&bytes_after, (void*)&data);
- XSync (xdisplay, False);
- err = gdk_error_trap_pop ();
+ XSync (GDK_DISPLAY_XDISPLAY (display), False);
+ err = gdk_x11_display_error_trap_pop (display);
if (err != Success ||
result != Success)
mapping = NULL;
mapping_length = 0;
- get_window_list (GDK_DISPLAY_XDISPLAY (context->display),
+ get_window_list (context->display,
GDK_ROOT_WINDOW(),
gdk_x11_get_xatom_by_name_for_display (context->display,
"_NET_CLIENT_LIST"),
{
gint pid;
- if (!get_cardinal (GDK_DISPLAY_XDISPLAY (context->display),
+ if (!get_cardinal (context->display,
mapping[n],
gdk_x11_get_xatom_by_name_for_display (context->display,
"_NET_WM_PID"),
if (window != None)
{
- ret = get_utf8_property (GDK_DISPLAY_XDISPLAY (context->display),
+ ret = get_utf8_property (context->display,
window,
gdk_x11_get_xatom_by_name_for_display (context->display,
"_NET_WM_NAME"));
if (ret == NULL)
- ret = get_utf8_property (GDK_DISPLAY_XDISPLAY (context->display),
+ ret = get_utf8_property (context->display,
window, gdk_x11_get_xatom_by_name_for_display (context->display,
"_NET_WM_ICON_NAME"));
}
gint height;
guchar *pixdata;
- if (read_rgb_icon (GDK_DISPLAY_XDISPLAY (context->display),
+ if (read_rgb_icon (context->display,
window,
size_pixels, size_pixels,
&width, &height,
if (gtk_widget_is_toplevel (widget))
{
+ GdkDisplay *display = gtk_widget_get_display (widget);
GdkWindow *root_window;
attributes.window_type = GDK_WINDOW_TOPLEVEL;
root_window = gdk_screen_get_root_window (screen);
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
if (priv->socket_window)
gdk_window = gdk_window_new (priv->socket_window,
&attributes, attributes_mask);
gtk_widget_set_window (widget, gdk_window);
gdk_display_sync (gtk_widget_get_display (widget));
- if (gdk_error_trap_pop ()) /* Uh-oh */
+ if (gdk_x11_display_error_trap_pop (display)) /* Uh-oh */
{
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
gdk_window_destroy (gdk_window);
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_pop_ignored (display);
gdk_window = gdk_window_new (root_window,
&attributes, attributes_mask);
gtk_widget_set_window (widget, gdk_window);
gtk_socket_size_request (GtkSocket *socket)
{
GtkSocketPrivate *private = socket->priv;
+ GdkDisplay *display;
XSizeHints hints;
long supplied;
-
- gdk_error_trap_push ();
+
+ display = gtk_widget_get_display (GTK_WIDGET (socket));
+ gdk_x11_display_error_trap_push (display);
private->request_width = 1;
private->request_height = 1;
}
private->have_size = TRUE;
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_pop_ignored (display);
}
static void
{
GtkAllocation allocation;
XConfigureEvent xconfigure;
+ GdkDisplay *display;
gint x, y;
g_return_if_fail (socket->priv->plug_window != NULL);
* coordinates. We still aren't really ICCCM compliant, since
* we don't send events when the real toplevel is moved.
*/
- gdk_error_trap_push ();
+ display = gdk_window_get_display (socket->priv->plug_window);
+ gdk_x11_display_error_trap_push (display);
gdk_window_get_origin (socket->priv->plug_window, &x, &y);
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_pop_ignored (display);
gtk_widget_get_allocation (GTK_WIDGET(socket), &allocation);
xconfigure.x = x;
xconfigure.above = None;
xconfigure.override_redirect = False;
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
XSendEvent (GDK_WINDOW_XDISPLAY (socket->priv->plug_window),
GDK_WINDOW_XID (socket->priv->plug_window),
False, NoEventMask, (XEvent *)&xconfigure);
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_pop_ignored (display);
}
static void
}
else if (private->plug_window)
{
- gdk_error_trap_push ();
+ GdkDisplay *display = gdk_window_get_display (private->plug_window);
+
+ gdk_x11_display_error_trap_push (display);
if (allocation->width != private->current_width ||
allocation->height != private->current_height)
allocation->width, allocation->height));
}
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_pop_ignored (display);
}
}
}
xkey.keycode = gdk_event->key.hardware_keycode;
xkey.same_screen = True;/* FIXME ? */
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (gdk_window_get_display (socket->priv->plug_window));
XSendEvent (GDK_WINDOW_XDISPLAY (socket->priv->plug_window),
GDK_WINDOW_XID (socket->priv->plug_window),
False,
(mask_key_presses ? KeyPressMask : NoEventMask),
(XEvent *)&xkey);
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_pop_ignored (gdk_window_get_display (socket->priv->plug_window));
}
static gboolean
{
g_warning (G_STRLOC ": Can't add non-GtkPlug to GtkSocket");
private->plug_window = NULL;
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_pop_ignored (display);
return;
}
{
GdkDragProtocol protocol;
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
if (!private->plug_window)
{
private->plug_window = gdk_x11_window_foreign_new_for_display (display, xid);
if (!private->plug_window) /* was deleted before we could get it */
{
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_pop_ignored (display);
return;
}
}
- XSelectInput (GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (socket))),
+ XSelectInput (GDK_DISPLAY_XDISPLAY (display),
GDK_WINDOW_XID (private->plug_window),
StructureNotifyMask | PropertyChangeMask);
- if (gdk_error_trap_pop ())
+ if (gdk_x11_display_error_trap_pop (display))
{
g_object_unref (private->plug_window);
private->plug_window = NULL;
/* OK, we now will reliably get destroy notification on socket->plug_window */
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
if (need_reparent)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
protocol = gdk_window_get_drag_protocol (private->plug_window, NULL);
if (protocol)
- gtk_drag_dest_set_proxy (GTK_WIDGET (socket), private->plug_window,
- protocol, TRUE);
+ gtk_drag_dest_set_proxy (widget, private->plug_window, protocol, TRUE);
G_GNUC_END_IGNORE_DEPRECATIONS
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_pop_ignored (display);
gdk_window_add_filter (private->plug_window,
gtk_socket_filter_func,
socket);
#ifdef HAVE_XFIXES
- gdk_error_trap_push ();
- XFixesChangeSaveSet (GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (socket))),
+ gdk_x11_display_error_trap_push (display);
+ XFixesChangeSaveSet (GDK_DISPLAY_XDISPLAY (display),
GDK_WINDOW_XID (private->plug_window),
SetModeInsert, SaveSetRoot, SaveSetUnmap);
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_pop_ignored (display);
#endif
_gtk_xembed_send_message (private->plug_window,
XEMBED_EMBEDDED_NOTIFY, 0,
- GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (socket))),
+ GDK_WINDOW_XID (gtk_widget_get_window (widget)),
private->xembed_version);
socket_update_active (socket);
unsigned long *data_long;
int status;
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
status = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
GDK_WINDOW_XID (window),
xembed_info_atom,
0, 2, False,
xembed_info_atom, &type, &format,
&nitems, &bytes_after, &data);
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_pop_ignored (display);
if (status != Success)
return FALSE; /* Window vanished? */
else if ((xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (display, "XdndAware")) ||
(xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (display, "_MOTIF_DRAG_RECEIVER_INFO")))
{
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
protocol = gdk_window_get_drag_protocol (private->plug_window, NULL);
if (protocol)
protocol, TRUE);
G_GNUC_END_IGNORE_DEPRECATIONS
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_pop_ignored (display);
return_val = GDK_FILTER_REMOVE;
}
else if (xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (display, "_XEMBED_INFO"))
gtk_socket_handle_map_request (socket);
else
{
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
gdk_window_show (private->plug_window);
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_pop_ignored (display);
gtk_socket_unmap_notify (socket);
}
xclient.data.l[3] = data1;
xclient.data.l[4] = data2;
- gdk_error_trap_push ();
+ gdk_x11_display_error_trap_push (display);
XSendEvent (GDK_WINDOW_XDISPLAY(recipient),
GDK_WINDOW_XID (recipient),
False, NoEventMask, (XEvent *)&xclient);
- gdk_error_trap_pop_ignored ();
+ gdk_x11_display_error_trap_pop_ignored (display);
}
/**